<template>
    <div class="personnelList">
        <el-breadcrumb separator="/" class="ml_5">
            <el-breadcrumb-item :to="{ path: '/' }">
                <i class="lh lh-seller fw_100"></i>
            </el-breadcrumb-item>
            <el-breadcrumb-item>帮助中心</el-breadcrumb-item>
            <el-breadcrumb-item>帮助列表</el-breadcrumb-item>
        </el-breadcrumb>
        <div class="content_Box box-shadow mt_15">
            <div class="py_5 px_10">
                <el-row>
                    <el-col :span="4">
                        <el-button
                            type="success"
                            class="fl mb_10"
                            @click="$router.push({path: '/helpAdd'})"
                            round
                            size="mini"
                        >新增帮助主题</el-button>
                    </el-col>
                    <el-col :span="20">

                    </el-col>
                </el-row>
            </div>
            <div class="tableMaxBox">
                <template>
                    <el-table :data="shopList" stripe>
                        <el-table-column prop="id" label="序号" align="center" width="80px">
                            <template slot-scope="{row,$index}">
                                <span>{{$index+1}}</span>
                            </template>
                        </el-table-column>
                        <el-table-column prop="shop_sn" label="封面图片" align="center"></el-table-column>
                        <el-table-column prop="shop_sn" label="帮助中心" align="center"></el-table-column>
                        <el-table-column prop="shop_sn" label="所属分类" align="center"></el-table-column>
                        <el-table-column prop="shop_sn" label="所属板块" align="center"></el-table-column>
                        <el-table-column prop="shop_sn" label="排序" align="center"></el-table-column>
                        <el-table-column prop="shop_sn" label="当前状态" align="center"></el-table-column>
                        <el-table-column prop="audit_time" label="发布人"></el-table-column>
                        <el-table-column prop="audit_name" label="发布时间"></el-table-column>

                        <el-table-column label="操作" width="100px" fixed="right">
                            <template slot-scope="{row,$index}">
                                <el-link
                                    type="primary"
                                    class="InfoFont text-success"
                                    :underline="false"
                                    @click="$router.push({path: '/helpEdit'})"
                                >查看</el-link>
                                <el-link
                                    type="danger"
                                    class="InfoFont text-success"
                                    :underline="false"
                                    @click="redactBtn(row,$index)"
                                >删除</el-link>
                            </template>
                        </el-table-column>
                    </el-table>
                    <!-- 分页组件 -->
                    <page :total="total" :pageNums="pageNum" @pagedata="onChildValue"></page>
                </template>
            </div>
        </div>
        <!-- 删除 -->
		<el-dialog :title="diaTitle" :visible.sync="StateShowStop" width="560px" :close-on-click-modal="false" :before-close='hiddenRY'>
			<div class="auditCentent">
				<span>确认删除吗？</span>
			</div>
			<div slot="footer" class="dialog-footer ">
				<span class="btnOK mr_20" @click="addMenuBtn()">确 定</span>
				<span class="resetBtn" @click="hiddenRY">取 消</span>
			</div>
		</el-dialog>
    </div>
</template>

<script>
var common = require("../../../static/tool.js");
import { mainfun } from "../../../assets/js/main.js";
export default {
    name: "HelpList",
    data() {
        return {
            id: "",
            windowSizeHeight: document.documentElement.clientHeight, //浏览器可视化窗口的大小
            screenHeight: document.documentElement.clientHeight,
            manageInfo: JSON.parse(sessionStorage.getItem("manageInfo")), //登录信息
            url: common.url,
            head_url: common.head_url,
            shopList: [], //店铺列表
            StateShowStop:false, //列表删除
            diaTitle:'',  //title
            //向分页组件传值
            total: 0,
            pageNum: "",
            pageSizeNow: "",
        };
    },
    created() {

    },
    mounted() {

    },
    methods: {
        listShop() {
            //获取商铺列表
            let fn = new FormData();
            fn.append("pageSize", this.pageSizeNow); //每页多少条
            fn.append("page", this.pageNum); //页数

            this.$http.post(this.url + "/shop/list", fn).then(
                (res) => {
                    console.log(res.data.data);
                    if (res.data.msg == "查询成功" || res.data.code == "200") {
                        if (res.data.data != null) {
                            res.data.data.list.forEach((item) => {
                                item.value = item.name;
                            });
                            this.shopList = res.data.data.list;
                            this.total = res.data.data.count;
                        } else {
                            this.shopList = [];
                            this.total = 0;
                        }
                    } else if (res.data.code == "8886") {
                        //code   8886  登录过期
                        sessionStorage.clear();
                        this.$alert("登录已过期，请重新登录 !", "提示", {
                            confirmButtonText: "确定",
                            callback: (action) => {
                                window.location = "login.html";
                            },
                        });
                        return;
                    } else {
                        this.$message.error(res.data.msg);
                        return;
                    }
                },
                (res) => {
                    this.$message.error("网络错误！");
                    return;
                }
            );
        },

        shearchBtn() {
            // 搜索
            this.pageNum = 1;
            this.listShop();
        },

        redactBtn(e,index) {
            this.ids = e.id;
            this.StateShowStop = true;
            this.diaTitle = '温馨提示';
        },
        //执行删除
        addMenuBtn(){
            // let fn = new FormData();
            // fn.append('id', this.ids); //相关id
            // fn.append('work_status', e);
            // this.$http.post(this.url + '/user/editUser', fn).then((res) => {
            //     // console.log(res);
            //     if (res.data.msg == '修改成功!' || res.data.code == '200') {
            //         this.$message.success(res.data.msg);
            //         this.listUser();
            //     } else if (res.data.code == '8886') { //code   8886  登录过期
            //         sessionStorage.clear();
            //         this.$alert('登录已过期，请重新登录 !', '提示', {
            //             confirmButtonText: '确定',
            //             callback: action => {
            //                 window.location = 'login.html';
            //             }
            //         });
            //         return;
            //     } else {
            //         this.$message.error(res.data.msg );
            //         //样式更换取消
            //         // this.renList[this.index].work_status=='1'?this.renList[this.index].work_status='2':this.renList[this.index].work_status='1'
            //         return;
            //     }
            // }, (res) => {
            //     this.$message.error('网络错误！');
            //     // this.renList[this.index].work_status=='1'?this.renList[this.index].work_status='2':this.renList[this.index].work_status='1'
            //     return;
            // })

            //关闭弹框
            this.hiddenRY();
        },

        hiddenRY(){
            this.StateShowStop = false;
        },

        //分页组件->子组件传值
        onChildValue(item) {
            this.pageNum = item[0];
            this.pageSizeNow = item[1];
            this.listShop();
        },
    },
    filters: {},
};
</script>

<style scoped>
.search_box {
    width: 790px;
}
.auditCentent .labels {
    min-height: 100px;
}
.auditCentent .labels .labels_label {
    float: left;
    cursor: pointer;
}
.check_label {
    background: var(--purple4);
    color: #fff;
    border: none;
}
.pdf {
    width: 860px;
    height: 600px;
}
@media (max-width: 767.78px) {
    .titleBox {
        height: 40px;
    }
}
</style>



// WEBPACK FOOTER //
// src/components/helpcenter/HelpList.vue